#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Project  : ecshop-gitee
# @File     : page_ecshop_back_shipments.py
# @Author   : LiuLei
# @Time     : 2021/7/3 10:54
import time
from selenium.webdriver.common.by import By


class PageEcshopBackShipments():
    """
    1.进入后台页面；
    2.点击查看订单
    3.点击生成发货单
    4.点击发货
    5.进入前台查询订单状态
    """

    def __init__(self, driver):
        self.driver = driver

        # 点击查看商品详情
        self.loc_ecshop_shipments = (By.NAME, 'to_delivery')
        self.loc_ecshop_view = (By.XPATH, '//div[@id="listDiv"]/table[1]/tbody/tr[3]/td[9]/a[1]')

        self.loc_ecshop_send = (By.NAME, 'delivery_confirmed')

    def back_ecshop_shipments(self):
        time.sleep(5)
        """
        1.点击发货按钮
        2.点击查看按钮
        3.点击发货
        """
        self.driver.find_element(*self.loc_ecshop_shipments).click()

        self.driver.find_element(*self.loc_ecshop_view).click()

        self.driver.find_element(*self.loc_ecshop_send).click()

    def back_ecshop_shipment(self):
        self.back_ecshop_shipments()
